home *** CD-ROM | disk | FTP | other *** search
/ Hackers Underworld 2: Forbidden Knowledge / Hackers Underworld 2: Forbidden Knowledge.iso / VIRUS / VIRUS101.001 < prev    next >
Internet Message Format  |  1994-07-17  |  14KB

  1. From: woodside@ttidca.TTI.COM (George Woodside)
  2. Newsgroups: comp.sys.atari.st,comp.sys.apple,comp.sys.mac,comp.sys.ibm.pc
  3. Subject: Virus 101 - Chapter 1
  4. Date: 1 Mar 89 14:39:58 GMT
  5.  
  6. Preface: The program VKILLER is specific to the ATARI ST. My apologies
  7. for not making this clear in the previous posting, which went to
  8. several newsgroups. I have recieved far too many requests for the
  9. program from users of other systems to reply to each one individually,
  10. and the mailer has bounced some of the replies I tried to send. If you
  11. have an Atari, VKILLER was posted here a few weeks ago, and is
  12. available in the archives, on GEnie, Compuserve, and from most public
  13. domain disk distributors and User Group libraries. The current version
  14. is 2.01. 
  15.  
  16. Initial postings will cover virus fundamentals, as they apply to the
  17. area of the Atari ST and, similarly, to MS-DOS systems. The file
  18. systems of the two machines are nearly identical. These general
  19. information articles will be cross-posted to the newsgroups in which
  20. this topic is now active. Future postings will be made only to the
  21. Atari newsgroup, since they will deal with viruses (the plural,
  22. according to Webster's, is viruses) known to exist in the ST world.
  23. They would automatically be different than an IBM virus, since they
  24. are in the 68000 instruction set, or from a Mac or Amiga virus, since
  25. the file systems differ. Since all the viruses I have located are the
  26. "BOOT SECTOR" type (far and away the most common), that's what I will
  27. dwell upon. If and when the proposed newsgroup comp.virus becomes
  28. active, it will be added to the list for all postings.
  29.  
  30. Your generic disclaimer: I just an old-school computer hacker, with 20
  31. years in the software business. I built my first IMSAI many years ago,
  32. and have had several different computers. That qualifies me to have
  33. spent a lot of time on computers, but nothing further. I may be wrong
  34. about some things, may have a different opinion than you or anybody
  35. else, or most anything else you'd care to have disclaimed. What I
  36. think is my own opinion, and in no way represents the opinion or
  37. position of my employer or anyone else. I've written several articles
  38. for magazines as well as software related to virus detection and
  39. killing, but I have been known to be wrong (so they tell me :^)).
  40.  
  41. While posting any kind of information about viruses may trigger
  42. someone to attempt creating one, I believe that the benefit of the
  43. knowledge to potential victims outweighs that risk. I don't believe
  44. that you can stop someone (who wishes to) from creating a virus by
  45. withholding information - it is already available from many sources.
  46. Since not all viruses act the same, or attempt to attack in the same
  47. manner, it may help potential (or current) victims to learn about the
  48. symptoms of the viruses known to exist, and how to protect themselves.
  49.  
  50. While the concept of viruses can be complex, I'll try to keep things
  51. at a level that should be understandable by most anyone past the
  52. casual user genre. However, since I've been at this sort of thing for
  53. some time, what I consider basic knowledge may not be familiar to
  54. everyone. Advance apologies are offered here for any invalid
  55. assumptions, typos, smart alec remarks, grammatic errors, or whatever
  56. offends you. 
  57.  
  58. Some basic terms, as they have come to be used in this area: 
  59.  
  60. A VIRUS is any program which spreads itself secretly. It may be
  61. destructive, a prank, or even intended to be helpful, but it spreads. 
  62.  
  63. A TROJAN HORSE is a program which executes one function secretly while
  64. appearing to be accomplishing some other task, or appearing to be some
  65. other program entirely. One task a Trojan Horse may accomplish is to
  66. install a virus, which would then spread itself.
  67.  
  68. A WORM is a program or function which imbeds itself inside another
  69. program, be it an application, part of a system, a library or
  70. whatever. It may or may not spread itself by some means, and may or
  71. may not have destructive intents. 
  72.  
  73. Now, to the basics of a disk (specifically floppies, but true of most
  74. hard disks as well): 
  75.  
  76. A DIRECTORY is a list of files and sub-directories. There is one
  77. primary directory (called the root directory) on a disk. It contains
  78. the entries for files, and other directories (called sub-directories,
  79. or folders on the Atari). Sub-directories (folders) may contain
  80. entries of other sub-directories, files, or both. Every file has one
  81. entry in the disk directory (or in some sub-directory). That entry
  82. contains, among other things, the file name, date and time of
  83. creation, length, and the address of the first entry in the File
  84. Allocation Table (FAT) for the file. 
  85.  
  86. A FAT is a File Allocation Table. It is a road map of how the
  87. operating system will locate data on a disk. Essentially, it is a
  88. series of pointers. The directory entry of a file points to the first
  89. FAT entry of that file. That entry points to the next, and so on,
  90. until the last entry, which contains a special value indicating end of
  91. file. There are two copies of the FAT on the disk, since it is
  92. absolutely critical. Lose the FAT, and the data on the disk becomes
  93. un-accessable. 
  94.  
  95. A BOOT SECTOR is the first sector on a floppy disk. With the Atari
  96. (and MS-DOS) system, it contains configuration information about the
  97. disk. That information includes how many tracks are on the disk, how
  98. many sectors per track, how many sides on the disk, how big the FATs
  99. and directories are, where the data begins, etc. On the MS-DOS
  100. systems, the boot sector contains the ID of the operating system under
  101. which it was formatted. On the Atari, that value is not used, but
  102. replaced (in part) by a number. That number should be different on
  103. every disk, and is used as part of the mechanism by which disk changes
  104. are detected. The boot sector may or may not contain executable code.
  105. If it does contain executable code, it is normally executed only at system
  106. powerup or system reset time. 
  107.  
  108. On all such disks, the boot sector is number 0, the first sector on the
  109. first side of the first track. On a standard format Atari disk, the
  110. next five sectors are the first copy of the FAT, the next five sectors
  111. are the second copy of the FAT, the next seven sectors are the root
  112. directory, and the remainder of the disk is available for data.
  113.  
  114. Now, on with the show: 
  115.  
  116. Floppy disks are changed on a regular basis while the computer is
  117. being used. More so on systems with no hard disks, but periodically on
  118. most all systems. This event, referred to as a "Media Change", is
  119. detected by the computer's disk drive. The disk door is opened, the
  120. status of the write protection changes as one disk is removed and
  121. another is inserted, etc. When that happens, the operating system must
  122. recognize that the disk has been changed before attempting to read or
  123. write to the new disk. The operating system reads the disk's boot
  124. sector to learn about the newly inserted disk. That instant, when the
  125. operating system checks the new disk, is when nearly all the boot
  126. sector viruses spread. We'll get to that in the next chapter, but first,
  127. a more primary question: 
  128.  
  129. How did the virus get in there? 
  130.  
  131. When a computer is booted up from a power off state, or reset (in most
  132. cases), it starts executing code from internal ROMs. Those ROMs set up
  133. primary vectors, minimal configuration information, and perform some
  134. fundamental tests. Then they start moving into uncharted waters. They
  135. have to find out what devices are attached, and get them into
  136. operating status. They also have to provide a means of expanding their
  137. own capabilities to support new devices, functions, and whatever else
  138. which may not have existed when the ROMs were created. One of the
  139. means by which this is accomplished is by checking various addresses
  140. for special codes, magic numbers, or any kind of response to a read
  141. or write. Another function which may be enabled is checking the boot
  142. sector on an inserted floppy disk for executable status. If that boot
  143. sector has executable status, the code contained in the boot sector is
  144. executed. That code may cause other portions of the disk to be loaded
  145. and executed, set variables or vectors, or nearly anything imaginable.
  146. That includes infecting the system with a virus, if that's what the
  147. boot sector code contains